package net.borlis.sample.web.context.mock;

import net.borlis.dictionaries.product.LifecycleStateDictionary;
import net.borlis.sample.db.em.OrganizeCurrentTransaction;
import net.borlis.sample.services.declaration.CreditCardDetailService;
import net.borlis.sample.services.declaration.output.CreditCardObject;
import net.borlis.encryption.client.EncryptionClientException;
import net.borlis.errors.annotations.ServerExceptionRegister;
import net.borlis.log.SimpleLogger;

import javax.enterprise.inject.Alternative;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceException;
import java.util.List;

/**
 * @author alex@borlis.net
 */
@Alternative
public class MockCreditCardDetailService implements CreditCardDetailService {

    @Override
    @ServerExceptionRegister(code = "613", expected = {PersistenceException.class, NoResultException.class,
            EncryptionClientException.class, IllegalArgumentException.class}, logMessage = "credit card cannot be created")
    @OrganizeCurrentTransaction
    @SimpleLogger
    public CreditCardObject createCreditCardDetail(LifecycleStateDictionary state, String locale, Number vitoId,
                                                   String cardType, String cardHolderFirstName, String cardHolderLastName,
                                                   String cardNumber, String cvc, String issueNumber,
                                                   Long validFrom, Long validTo, Number userId) /* throws ServerException */ {
        return null;
    }

    @Override
    @ServerExceptionRegister(code = "611", expected = {PersistenceException.class, NoResultException.class,
            EncryptionClientException.class}, logMessage = "credit card cannot be deleted")
    @OrganizeCurrentTransaction @SimpleLogger
    public void deleteCreditCardDetail(LifecycleStateDictionary state, String locale, Number ccId, Number userId) /* throws ServerException */ {
    }

    @Override
    @ServerExceptionRegister(code = "612", expected = {PersistenceException.class, NoResultException.class,
            EncryptionClientException.class}, logMessage = "credit card cannot be updated")
    @OrganizeCurrentTransaction @SimpleLogger
    public CreditCardObject updateCreditCardDetail(LifecycleStateDictionary state, String locale, Number ccId,
                                                   String cardType, String cardHolderFirstName, String cardHolderLastName,
                                                   String cardNumber, String cvc, String issueNumber, Long validFrom,
                                                   Long validTo, Number userId) /* throws ServerException */ {
        return null;
    }

    @Override
    @ServerExceptionRegister(code = "614", expected = {PersistenceException.class, NoResultException.class,
            EncryptionClientException.class}, logMessage = "credit card cannot be returned") @SimpleLogger
    public CreditCardObject getCreditCardDetail(LifecycleStateDictionary state, String locale, Number ccId, Number userId) /* throws ServerException */ {
        return null;
    }

    @Override
    @ServerExceptionRegister(code = "615", expected = {PersistenceException.class, NoResultException.class,
            EncryptionClientException.class}, logMessage = "credit card list cannot be returned") @SimpleLogger
    public List<CreditCardObject> getCreditCardDetails(LifecycleStateDictionary state, String locale, Number vitoId,
                                                       String holder, Number userId) /* throws ServerException */ {
        return null;
    }

    @Override
    public void findAndInitDynamixAccountById(Number userId) {

    }

    @Override
    public void findAndInitVitoById(LifecycleStateDictionary state, Number vitoId) {

    }

}
